package com.pdg.dungeondelver.client;

import java.util.Iterator;

import org.newdawn.slick.GameContainer;
import org.newdawn.slick.Graphics;
import org.newdawn.slick.SlickException;
import org.newdawn.slick.state.StateBasedGame;

import com.pdg.dungeondelver.client.constants.PropertyGroupConstants;
import com.pdg.dungeondelver.configuration.Configuration;

public class PlayState extends BaseGameState{

	public PlayState(Configuration theConfiguration, Client theClient,
			States theState) {
		super(theConfiguration, theClient, theState);
	}
	@Override
	public void keyPressed(int arg0, char arg1) {
		super.keyPressed(arg0, arg1);
	}

	@Override
	public void keyReleased(int arg0, char arg1) {
		super.keyReleased(arg0, arg1);
	}

	@Override
	public void enter(GameContainer gc, StateBasedGame sbg)
			throws SlickException {
		super.enter(gc,sbg);
	}

	@Override
	public void render(GameContainer gc, StateBasedGame sbg, Graphics g)
			throws SlickException {
		super.render(gc, sbg, g);
		Iterator<String> keys = getConfiguration().getPropertyGroups().get(PropertyGroupConstants.RENDERERS).getProperties().keySet().iterator();
		while(keys.hasNext()){
			Renderer renderer = getConfiguration().getPropertyGroups().get(PropertyGroupConstants.RENDERERS).<Renderer>get(keys.next());
			renderer.render(g,getClient().getAtlas());
		}
	}

	@Override
	public void update(GameContainer gc, StateBasedGame sbg, int delta)
			throws SlickException {
		super.update(gc, sbg, delta);
	}

}
